﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace WizzardTheGame
{
    class WeaponMenu: Menu
    {
        private Weapon shownWeapon;
        private ObjectText stats;

        #region Properties
        
        public Weapon ShownWeapon
        {
            get { return shownWeapon; }
            set 
            { 
                shownWeapon = value;
                getStats();
            }
        }

        public ObjectText Stats
        {
            get { return stats; }
            set { stats = value; }
        }

        #endregion

        public WeaponMenu():base()
        {
            Stats = new ObjectText();
            Stats.Text = "Hej";
            Stats.Font = GameWorld.getInstance().Content.Load<SpriteFont>("Fonts\\MenuText");
            Stats.Color = Color.Gray;
            Stats.AlphaValue = 255;
            Stats.Position = new Vector2(GameWorld.getInstance().Graphics.Viewport.Width / 2,( GameWorld.getInstance().Graphics.Viewport.Height/2)+120);
            Stats.IsVisible = true;
        }


        public override void Draw()
        {
            base.Draw();
            if (!IsActive) return;
            Vector3 oldPos = ShownWeapon.ItemModel.Position;
            ShownWeapon.ItemModel.Position = GameWorld.getInstance().Camera.LookAt.Position;
            ShownWeapon.ItemModel.IsVisible = true;
            ShownWeapon.ItemModel.Draw();
            ShownWeapon.ItemModel.IsVisible = false;
            ShownWeapon.ItemModel.Position = oldPos;
            stats.Draw();
            
        }

        public void getStats()
        {
            string text = "";
            text += "AttackPower: " + ShownWeapon.AttackPowerBonus;
            text += "\n" + "HP: " + ShownWeapon.HpBonus;
            if (GameWorld.getInstance().Player.EquippedWeapon.Equals(ShownWeapon))
            {
                text += "\n" + "Equipped";
            }
            Stats.Text = text;
        }

    }


}
